﻿<#
# driver.ps1
# 2016-08-03 @ Michell
# For factory to identify system information only, main function.
#>

$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$FWInfo = Get-WmiObject -class Win32_BIOS
$EcVer = $FWInfo.EmbeddedControllerMajorVersion.ToString("d") + "." + $FWInfo.EmbeddedControllerMinorVersion.ToString("d")
$MemInfo = Get-WmiObject win32_PhysicalMemory | select DeviceLocator, Speed, @{name="Capacity";Expression={($_.Capacity/1mb).tostring("N0") + " MB"}}
$DiskInfo = Get-WmiObject Win32_DiskDrive | select  Model, @{name="Size";Expression={($_.Size/1mb).tostring("N0") + " MB"}}
If(Test-Path $scriptPath/tmp.log){
  $ME = $(select-string -path $scriptPath/tmp.log -pattern "FIT Version" –simplematch).Line.Split(" ")[-1]
}
$NetworkDev = Get-WmiObject win32_networkadapterconfiguration | where{$_.description -eq "Realtek PCIe GBE Family Controller"}

$obj = New-Object -Type PSObject -Property @{
    "BIOS Version" = $FWInfo.SMBIOSBIOSVersion
    "EC Version"   = $EcVer
    "CPU Info"     = $(Get-WmiObject Win32_Processor).Name
    "Memory Info"  = $MemInfo
    "Disk Info"    = $DiskInfo
    "ME Version"   = $ME
    "Mac Address"  = $NetworkDev.MACAddress
    "Serial Number" = $FWInfo.SerialNumber
    "Product Name"  = $(Get-WmiObject Win32_BaseBoard).Product

}

Write-Output $obj

